<tagLib name="html" />
<include file="Public:header" />
<script type="text/javascript" src="../Public/js/Jquery/ui/jquery-1.8.3.js"></script>
<script type="text/javascript" src="../Public/js/artDialog/artDialog.js"></script>
<script type="text/javascript" src="../Public/js/common.js"></script>
<script type="text/javascript" src="../Public/js/FusionCharts.js"></script>
<script type="text/javascript" src="../Public/js/chart.js"></script>
<script type="text/javascript">
//报表控件是否加载完毕的标志
var chartLoaded = false;

/**
 * 更新报表控件内的数据
 */
function updateChart(domId){
    //仅当控件已经加载完以后再更新数据
    if (chartLoaded){
       ///通过Dom Id获取报表控件
       var chartObj = getChartFromId(domId);
       
       //获取查询参数
       var ordertype = document.getElementById("reporttype").value;
       var starttime =  document.getElementById("begin_time").value;
       var endtime =  document.getElementById("end_time").value
       //更新Xml
       var params = { "ordertype": ordertype, "starttime":starttime, "endtime":endtime };
       var url = "__URL__/getOrderXml";
       $.post(url, params, function(data){
    	   chartObj.setDataXML(data);
   		});
    }
}

/**
 * 控件加载完后自动调用该方法
 * @param domId 报表控件Id
 */
 function FC_Rendered(domId){ 
    //通过Js方法更新报表数据
    //判断是否是需要更新的控件
    if (domId=="chart1Id"){ 
       //当控件加载完以后，将对应的其他控件置为可用
       document.getElementById("reporttype").disabled = false;

       //将对应Flag置为True
       chartLoaded = true;

       /* xl注释， 考虑到数据的复杂性和数据量的庞大，暂时不在加载页面的时候进行报表的默认加载
       //通过Dom Id获取报表控件
       var chartObj = getChartFromId(domId);

       //更新Xml
       chartObj.setDataXML("<chart></chart>");
       */
    } 
    return true; 
 }
</script>

<div class="con_box right">
  <div class="u_content">
    <div class="con_tit"> 
      <ul class="left"><img src="../Public/images/jiao.gif"/></ul>
      <ul class="tit_bg">订单报表</ul> 
    </div>
    <div class="con_main left">          
           <div class="left con_admin">
            <div class=" state left">
                 <div class=" state_form" >
                 <label>报表类型：</label>
                 <select id="reporttype" name="reporttype" class="input3" disabled>
                    <option value="-1">请选择</option>
                    <option value="0">日报表</option>
                    <option value="1">月报表</option>
                 </select>                
                 <label>时间：</label><input id="begin_time" name="begin_time" type="text" class="input1" onFocus="HS_setDate(this)" value="{$begin_time}"/>
                 <label>到：</label><input id="end_time" name="end_time" type="text" class="input1" onFocus="HS_setDate(this)" value="{$end_time}"/>                                             
                <input class="get"  type="button" value="查询 " onclick="javascript:updateChart('chart1Id');" > 
                </div>   
            </div>  
           </div> 
           <div class="state left"> 
               <div  id="chart1div" class=" sta_list">
               </div> 
               <script language="JavaScript"> 
			       var chart1 = new FusionCharts("../Public/charts/Scroll2D.swf", "chart1Id", "800", "400", "0", "1"); 
			       //Initialize chart with empty data. We'll feed it data on the chart's FC_Rendered event.
			       chart1.setDataXML("<chart></chart>");
			       chart1.render("chart1div");
			   </script>
           </div>       
    </div>     
  </div>
</div>

<tagLib name="html" />
<include file="Public:foot" />